﻿<%@ WebHandler Language="C#" Class="save" %>

using System;
using System.Web;

public class save : IHttpHandler {
    
    public void ProcessRequest (HttpContext context) {
        context.Response.ContentType = "text/plain";
        
        string batch_id = context.Request.Params["batch_id"];
        string image_id = context.Request.Params["image_id"];
        string save_way = context.Request.Params["save_way"];
        string batch_number = context.Request.Params["batch_number"];

        context.Response.Write(cmdsave(batch_id, image_id, batch_number));

       // context.Response.Write("{\"code\":0,\"batch_id\":\"" + batch_id + "\",\"image_id\":\"" + image_id + "\",\"save_way\":\"" + save_way + "\",\"image_id\":\"" + image_id + "\"}");
    }
    MsSqlHelper mssql = new MsSqlHelper();
    public string cmdsave(string batch_id, string image_id, string batch_number="")
    {
        try
        {
            string SqlStr = "update [ImageDoc] set detailid='" + batch_id + "',fzxx1='" + batch_number.ToUpper() + "' where imageid='" + image_id + "'";
            mssql.ExecuteSql(SqlStr);
            return "{\"code\":1,\"batch_id\":\"" + batch_id + SqlStr + "\",\"image_id\":\"" + image_id + "\"}";
        }
        catch (Exception ex)
        {
            return "{\"code\":0,,\"msg\":\""+ex.Message+"\",\"batch_id\":\"" + batch_id  + "\",\"image_id\":\"" + image_id + "\"}";  
        }
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }
}